package com.adderis.soft.domain.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @author Reda
 * @version 1.0
 * @created 20-avr.-2014 22:47:44
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "inci", catalog = "adderis")
public class Inci implements java.io.Serializable {

	private int inciid;
	private String inci;
	private Date createtimestamp;
	private String statutcode;
	private Date updatetimesstamp;
	private Date deletiontimesstamp;
	private Set<NomCommercial> nomCommercials = new HashSet<NomCommercial>(0);

	public Inci() {
	}

	public Inci(int inciid) {
		this.inciid = inciid;
	}

	public Inci(int inciid, String inci) {
		this.inciid = inciid;
		this.inci = inci;
	}

	@Id
	@Column(name = "iNCIID", unique = true, nullable = false)
	public int getInciid() {
		return this.inciid;
	}

	public void setInciid(int inciid) {
		this.inciid = inciid;
	}

	@Column(name = "INCI", length = 100)
	public String getInci() {
		return this.inci;
	}

	public void setInci(String inci) {
		this.inci = inci;
	}

	@Column(name = "createdatetime")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreatetimestamp() {
		return createtimestamp;
	}

	public void setCreatetimestamp(Date createtimestamp) {
		this.createtimestamp = createtimestamp;
	}

	@Column(name = "statutcode", length = 10)
	public String getStatutcode() {
		return statutcode;
	}

	public void setStatutcode(String statutcode) {
		this.statutcode = statutcode;
	}

	@Column(name = "updatedatetime")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getUpdatetimesstamp() {
		return updatetimesstamp;
	}

	public void setUpdatetimesstamp(Date updatetimesstamp) {
		this.updatetimesstamp = updatetimesstamp;
	}

	@Column(name = "deletiondatetime")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getDeletiontimesstamp() {
		return deletiontimesstamp;
	}

	public void setDeletiontimesstamp(Date deletiontimesstamp) {
		this.deletiontimesstamp = deletiontimesstamp;
	}

	@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinTable(name = "joinnomcommercialtoinci", catalog = "adderis", joinColumns = { @JoinColumn(name = "iNCIID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "	nomCommercialID", nullable = false, updatable = false) })
	public Set<NomCommercial> getNomCommercials() {
		return nomCommercials;
	}

	public void setNomCommercials(Set<NomCommercial> nomCommercials) {
		this.nomCommercials = nomCommercials;
	}

}
